package concurrency.chapter3;

/**
 * @author 夏焰波
 * @date 2020-06-04 1:13
 */
public class CreateThread3 {
    private int i = 0;
    private byte[] bytes = new byte[1024];
    private static int counter = 0;

    //JVM will create a thread named "main"
    public static void main(String[] args) {
        //create a JVM stack


        int j = 0;//局部变量
        int[] arr = new int[1024];//局部变量放在虚拟机栈里，具体的数据放在堆里

        //java.lang.StackOverflowError
        //26075
        try {
            add(0);
        } catch (Error e) {
            e.printStackTrace();
            System.out.println(counter);
        }
    }

    private static void add(int i) {
        ++counter;
        add(i + 1);
    }
}
